package pokemon;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class tempRead 
{
	public tempRead() throws FileNotFoundException
	{
		String nextLine;
		BufferedReader pokeReader = new BufferedReader(new FileReader("dexTest.txt"));
		try 
		{
			while((nextLine = pokeReader.readLine()) != null)
			{
				//Look for strings instead. 
				//First string is num.
				String nextString = nextLine.replaceFirst("num", "@");
				String test = nextString.split("@")[1];
				//The number is right after the semicolon.
				String number = test.replaceFirst(":", "").split(",")[0];
				nextString = nextString.replaceFirst("species", "@");
				test = nextString.split("@")[2];
				String species = test.replaceFirst(":", "").replaceAll("\"","").split(",")[0];

				nextString = nextString.replaceFirst("types", "@");
				test = nextString.split("@")[3];
				//So now we have ["Item1","items2"]
				test = test.substring(test.indexOf("[") + 1);
				test = test.substring(0, test.indexOf("]"));
			    String[] typeList = test.split(",");
			    String typeOne = typeList[0].replaceAll("\"","");
			    String typeTwo = "VOID";
			    if(typeList.length>=2)
			    {
			    	typeTwo = typeList[1].replaceAll("\"", "");
			    }
			    nextString = nextString.replaceFirst("abilities", "@");
			    test = nextString.split("@")[4];
			    
			    test = test.substring(test.indexOf("{") + 1);
			    test = test.substring(0, test.indexOf("}"));
			    String[] abilList = test.split(",");
			    String abilOne = abilList[0].replaceAll("\"","").split(":")[1];
			    String abilTwo = "(NoAbility)";
			    String abilThree = "(NoAbility)";
			    if(abilList.length>=2)
			    {
			    	abilTwo = abilList[1].replaceAll("\"", "").split(":")[1];
			    }
			    if(typeList.length>=3)
			    {
			    	abilThree = abilList[2].replaceAll("\"", "").split(":")[1];
			    }
			    abilOne = abilOne.replaceFirst(" ", "-");
			    abilTwo = abilTwo.replaceFirst(" ", "-");
			    abilThree = abilThree.replaceFirst(" ", "-");
			    //System.out.println(abilOne);
			    //System.out.println(abilTwo);
			    //System.out.println(abilThree);
				//Check size of types, make sure it's one or two.
				//System.out.println(typeOne);
//				System.out.println(typeTwo);
			    System.out.println(number+":"+0+" "+species+" "+typeOne.toUpperCase()+" "+typeTwo.toUpperCase()+" "+abilOne+" "+abilTwo+" "+abilThree+" "+"0"+" "+"0"+" "+"0"+" "+"0"+" "+"0"+" "+"0");
			}
			//venusaurmega:{num:3,species:"Venusaur-Mega",baseSpecies:"Venusaur",forme:"Mega",formeLetter:"M",types:["Grass","Poison"],baseStats:{hp:80,atk:100,def:123,spa:122,spd:120,spe:80},abilities:{0:"Thick Fat"},heightm:2.4,weightkg:155.5,color:"Green",prevo:"ivysaur",evoLevel:32,eggGroups:["Monster","Plant"]},
			//venusaur:{num:3,species:"Venusaur",types:["Grass","Poison"],genderRatio:{M:0.875,F:0.125},baseStats:{hp:80,atk:82,def:83,spa:100,spd:100,spe:80},abilities:{0:"Overgrow",H:"Chlorophyll"},heightm:2,weightkg:100,color:"Green",prevo:"ivysaur",evoLevel:32,eggGroups:["Monster","Plant"],otherFormes:["venusaurmega"]},
			//charizard:{num:6,species:"Charizard",types:["Fire","Flying"],genderRatio:{M:0.875,F:0.125},baseStats:{hp:78,atk:84,def:78,spa:109,spd:85,spe:100},abilities:{0:"Blaze",H:"Solar Power"},heightm:1.7,weightkg:90.5,color:"Red",prevo:"charmeleon",evoLevel:36,eggGroups:["Monster","Dragon"],otherFormes:["charizardmegax","charizardmegay"]},
			//charizardmegax:{num:6,species:"Charizard-Mega-X",baseSpecies:"Charizard",forme:"Mega-X",formeLetter:"X",types:["Fire","Dragon"],baseStats:{hp:78,atk:130,def:111,spa:130,spd:85,spe:100},abilities:{0:"Tough Claws"},heightm:1.7,weightkg:110.5,color:"Red",prevo:"charmeleon",evoLevel:36,eggGroups:["Monster","Dragon"]},
			//charizardmegay:{num:6,species:"Charizard-Mega-Y",baseSpecies:"Charizard",forme:"Mega-Y",formeLetter:"Y",types:["Fire","Flying"],baseStats:{hp:78,atk:104,def:78,spa:159,spd:115,spe:100},abilities:{0:"Drought"},heightm:1.7,weightkg:100.5,color:"Red",prevo:"charmeleon",evoLevel:36,eggGroups:["Monster","Dragon"]},
			//1:0 Bulbasaur GRASS POISON Overgrow (NoAbility) Chlorophyll 45 49 49 65 65 45 
			//bulbasaur
			//num
			//1,species
			//"Bulbasaur",types
			//["Grass","Poison"],genderRatio
			//{M:0.875,F:0.125},baseStats
			//{hp
			//45,atk
			//49,def
			//49,spa
			//65,spd
			//65,spe
			//45},abilities
			//{0
			//"Overgrow",H
			//"Chlorophyll"},heightm
			//0.7,weightkg:6.9,color:"Green",evos:["ivysaur"],eggGroups:["Monster","Plant"]},
			
		}
		catch(Exception e)
		{
			System.out.println(e);
		}
	}
}
